<template>
  <el-dialog
    v-dialogDrag
    ref="tree"
    title="资源分配："
    :visible.sync="resourcedialogVisible"
    width="60%"
    length="100%"
    :before-close="handleClose"
    @close="onBtnCancelClick"
  >
    <div style="overflow: auto; overflow-y: auto">
      <el-card
        v-loading="listLoading"
        shadow="always"
        class="box-card"
        style="overflow: auto"
      >
        <el-tree
          ref="tree"
          node-key="id"
          show-checkbox
          :data="resourceData"
          @node-click="handleNodeClick"
        />
      </el-card>
    </div>
    <span slot="footer">
        <el-button @click="resourcedialogVisible = false">取 消</el-button>
        <el-button v-if="!isReviewPerMission" type="primary" @click="assignResource">确 定</el-button>
      </span>
  </el-dialog>
</template>

<script>
export default {
  name: 'resource_dialog',
  props:{
    listLoading:{ type:Boolean, required: true },
    resourceData:{ type: Array, required: true },
    isReviewPerMission:{ type:Boolean,required: true },
    resourcedialogVisible:{ type:Boolean, required: true}
  },
  data(){
    return{
    }
  },
  mounted() {
  },
  methods:{
    handleClose(){
      this.$emit("handleClose")
    },
    handleNodeClick(data){
      this.$emit("handleNodeClick",data)
    },
    assignResource(){
      this.$emit("assignResource")
    },
    onBtnCancelClick(){
      this.queryLoading = true
      this.$emit('CancelButtonClick', this)
      this.queryLoading = false
      this.resourcedialogVisible = false
    }
  }
}

</script>

<style scoped>

</style>
